
[#macro orderitemUpdateView]
    <div class="model-form">
        <el-page-header @back="goBack" content="更新">
        </el-page-header>
        <div class="model-content">
            <el-form ref="ruleForm" :rules="rules" :model="form" label-width="160px" >
                <el-row :gutter="10">
 <el-col :span="12">
     <el-form-item label="购买数量" size="mini" prop="size">
             <el-input v-model="form.size" name="size">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="退货数量" size="mini" prop="returnNum">
             <el-input v-model="form.returnNum" name="returnNum">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="退款金额" size="mini" prop="returnAmount">
             <el-input v-model="form.returnAmount" name="returnAmount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="售后状态" size="mini" prop="refundState">
             <el-input v-model="form.refundState" name="refundState">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="单位" size="mini" prop="unit">
             <el-input v-model="form.unit" name="unit">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="重量" size="mini" prop="weight">
             <el-input v-model="form.weight" name="weight">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="单价" size="mini" prop="price">
             <el-input v-model="form.price" name="price">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="成交单价" size="mini" prop="realPrice">
             <el-input v-model="form.realPrice" name="realPrice">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="运费" size="mini" prop="freight">
             <el-input v-model="form.freight" name="freight">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="小计" size="mini" prop="subtotal">
             <el-input v-model="form.subtotal" name="subtotal">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="优惠金额" size="mini" prop="discountAmount">
             <el-input v-model="form.discountAmount" name="discountAmount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="平台优惠" size="mini" prop="platformDiscount">
             <el-input v-model="form.platformDiscount" name="platformDiscount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="积分抵扣" size="mini" prop="integralDiscount">
             <el-input v-model="form.integralDiscount" name="integralDiscount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="使用积分" size="mini" prop="useIntegral">
             <el-input v-model="form.useIntegral" name="useIntegral">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="使用红包" size="mini" prop="useRedPacket">
             <el-input v-model="form.useRedPacket" name="useRedPacket">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="单件商品红包抵扣" size="mini" prop="redPacketDiscount">
             <el-input v-model="form.redPacketDiscount" name="redPacketDiscount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="实际成交金额" size="mini" prop="realAmount">
             <el-input v-model="form.realAmount" name="realAmount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="已经支付" size="mini" prop="paidAmount">
             <el-input v-model="form.paidAmount" name="paidAmount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="实际用户支付金额" size="mini" prop="payAmount">
             <el-input v-model="form.payAmount" name="payAmount">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="是否是赠品" size="mini" prop="giveType">
             <el-input v-model="form.giveType" name="giveType">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="商品sku" size="mini" prop="skuAttr">
             <el-input v-model="form.skuAttr" name="skuAttr">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="商品名称" size="mini" prop="name">
             <el-input v-model="form.name" name="name">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="商品封面" size="mini" prop="logo">
             <el-input v-model="form.logo" name="logo">
             </el-input>
     </el-form-item>
      
 </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24"  style="text-align: right;padding-bottom: 20px;padding-top: 20px;">
                        <el-button @click="goBack">取消</el-button>
                        <el-button type="primary" @click="updateData">确定</el-button>
                    </el-col>
			     </el-row>
            </el-form>
        </div>
    </div>
[/#macro]

[#macro orderitemUpdateConfig]
<script type="text/x-template" id="my-orderitem-update">
    [@orderitemUpdateView /]
</script>
<script type="text/javascript">
    //更新组件开始
    var orderitemUpdateConfig = {};
    orderitemUpdateConfig.template = "#my-orderitem-update";
    orderitemUpdateConfig.methods = config.basicMethod();
    orderitemUpdateConfig.methods.updateData = function () {
        var self = this;
        this.$refs["ruleForm"].validate(function(valid){
            if (valid) {
                self.updateDataPost();
            } else {
                console.log('error submit!!');
                return false;
            }
        });
    }

    orderitemUpdateConfig.methods.updateDataPost = function () {
        var self = this, data = this.form;
        //delete data.orderitemCatalog;
        if (this.deforeUpdateData) {
            this.deforeUpdateData();
        }
        this.postData("${siteurl}tenantRest/orderitem/update.htm", data, function (res) {
            if (res.code == 0) {
                self.$message({
                    message: '修改数据成功',
                    type: 'success'
                });
                //window.history.go(-1)
                self.$router.go(-1);
            } else {
                self.$message.error(res.msg);
            }
        });
    }
    orderitemUpdateConfig.data = function () {
        return {
            form: {
                size: '',
                returnNum: '',
                returnAmount: '',
                refundState: '',
                unit: '',
                weight: '',
                price: '',
                realPrice: '',
                freight: '',
                subtotal: '',
                discountAmount: '',
                platformDiscount: '',
                integralDiscount: '',
                useIntegral: '',
                useRedPacket: '',
                redPacketDiscount: '',
                realAmount: '',
                paidAmount: '',
                payAmount: '',
                giveType: '',
                skuAttr: '',
                name: '',
                logo: ''            },
            rules: {
            }
        }
    };

    orderitemUpdateConfig.mounted = function () {
        var id = this.$route.query.id;
        var self = this;
        var data = {};
        data.id = id;
        this.postData("${siteurl}tenantRest/orderitem/view.htm", data, function (res) {
            if (res.code == 0) {
                self.form = res;
            }
        });
    }
    orderitemUpdateConfig.computed = {};

    orderitemUpdateConfig.destroyed = function () {
            console.log("destroyed add view ");
            
	}
    var orderitemUpdateView = Vue.component('update-view', orderitemUpdateConfig);
    //更新组件结束
</script>
[/#macro]